package tt.lab.designparttern.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

class MyInvocationHandler implements InvocationHandler {
	private Object target;

	public MyInvocationHandler(Object t) {
		target = t;
	}

	public Object invoke(Object proxy, Method m, Object[] args) throws Throwable{
		
		System.out.println("TraceHandler.invoke(): before...");
		System.out.println("MyInvocationHandler.invoke(): "+m.getName());
		Object invoke = m.invoke(target, args);
		System.out.println("TraceHandler.invoke(): ...after");
		return invoke; 
	}

}

